<?php
/*
 * Letutao单入口
 * @copyright (c) 2010-3000 Letutao All Rights Reserved
 * @author QiuJun
 * @Email:letutao@qq.com
 */

//定义网站根目录,APP目录,DATA目录，Letutao核心目录
session_start();


define('IN_TS',true);
define('WWWPREFIX','http://'.$_SERVER['HTTP_HOST']);
define('THINKROOT', dirname(__FILE__));
define('THINKAPP', THINKROOT.'/app');
define('THINKDATA',THINKROOT.'/data');
define('THINKSAAS', THINKROOT.'/letutao');
define('THINKINSTALL',THINKDATA.'/install');
define('THINKPLUGIN',THINKDATA.'/plugins');
if(isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] != WWWPREFIX.'/index.php/user/login'){
	if(isset($_SESSION['script_login'])){
		unset($_SESSION['script_login']);
	}
}

if(isset($_SESSION['LOGOUT'])){
	if(isset($_SESSION['LOGOUT_COUNT']) && $_SESSION['LOGOUT_COUNT']>=1){
		unset($_SESSION['LOGOUT']);
		unset($_SESSION['LOGOUT_COUNT']);
		unset($_SESSION['script_logout']);
	}else{
		$_SESSION['LOGOUT_COUNT'] = 1;
	}
}



//装载Letutao核心
include THINKROOT.'/letutao/letutao.php';

//装载uc客户端实现
include THINKROOT.'/letutao/uc.php';
//除去加载内核运行时间统计开始
$time_start = getmicrotime();

if(file_exists(THINKROOT.'/data/config.inc.php')){
	//装载APP应用
	include THINKROOT.'/app/index.php';
}else{
	//装载安装程序
	include 'install/index.php';
}

unset($GLOBALS);